<?php

namespace app\system\controller;

use think\facade\Db;

class User extends Base
{
    /**
     *  获取用户列表
     */
    public function TableDataInfo()
    {
        $sql = "SELECT
	u.user_id as userId,
	u.dept_id as deptId,
	u.nick_name as nickName,
	u.user_name as userName,
	u.email ,
	u.avatar,
	u.phonenumber,
	u.sex,
	u.STATUS,
	u.del_flag as delFlag,
	u.login_ip as loginIp,
	u.login_date as loginDate,
	u.create_by as createBy,
	u.create_time as createTime,
	u.remark,
	d.dept_name as deptName,
	d.leader 
FROM
	sys_user u
	LEFT JOIN sys_dept d ON u.dept_id = d.dept_id 
WHERE
	u.del_flag = '0'";

        $dataList = Db::query($sql); //[ 'uid'=> $uid]

        $returnData = [
            'code'=> 200,
            'msg'=> '操作成功',
            'rows'=> $dataList,
            'total'=> count($dataList)
        ];
        return json($returnData);

    }

    /**
     *  导出用户列表
     */
    public function export()
    {

    }

    /**
     * 导入数据
     */
    public function importData()
    {
    }

    /**
     * 获取导入模板
     */
    public function importTemplate()
    {

    }

    /**
     * 根据用户编号获取详细信息
     */
    public function getInfo()
    {

    }

    /**
     * 新增用户
     */
    public function add()
    {

    }

    /**
     * 修改用户
     */
    public function edit()
    {

    }

    /**
     * 删除用户
     */
    public function remove()
    {

    }

    /**
     * 重置密码
     */
    public function resetPwd()
    {

    }

    /**
     * 状态修改
     */
    public function changeStatus()
    {

    }

    /**
     * 根据用户编号获取授权角色
     */
    public function authRole()
    {

    }

    /**
     * 获取部门树列表
     */
    public function deptTree()
    {

    }
}